package com.example.controller;

import com.example.pojo.Menu;
import com.example.pojo.Result;
import com.example.service.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
public class MenuController {
    @Autowired
    private MenuService menuService;
    @GetMapping("/menu")
    public Result menu(){
        log.info("主菜单及二级菜单");
        List<Menu> menu = menuService.getMenuWithSubMenu();
        return Result.success(menu);
    }

}
